﻿// -----------------------------------------------------------------------
// <copyright file="ICacheManager.cs" company="EPAM Systems">
////Copyright (c) EPAM Systems, 2012. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------

namespace MBOP.Core.Interfaces.Managers
{
	using System;

	/// <summary>
	/// Provides the common interface of the cache operations.
	/// </summary>
	public interface ICacheManager
	{
		#region Methods

		/// <summary>
		/// Adds the item to cache.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <param name="item">The item.</param>
		/// <param name="isSliding">Defines storing type. </param>
		/// <param name="expiration">The Expiration interval</param>
		void Add(string key, object item, bool isSliding, TimeSpan expiration);

		/// <summary>
		/// Adds the item to cache.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <param name="item">The item.</param>
		/// <param name="isSliding">Defines storing type. </param>
		void Add(string key, object item, bool isSliding);
		
		/// <summary>
		/// Gets the item from cache.
		/// </summary>
		/// <typeparam name="T">The type of the item.</typeparam>
		/// <param name="key">The key.</param>
		/// <returns>The item.</returns>
		T GetItem<T>(string key) where T : class;
		
		/// <summary>
		/// Checks that item in cache with specified key.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <returns>The result of checking operation.</returns>
		bool IsInCache(string key);

		#endregion
	}
}
